home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / catman / p_man / cat3 / qglwidget.Z / qglwidget
Encoding:
Text File  |  1998-10-28  |  18.6 KB  |  331 lines

  1.  
  2.  
  3.  
  4.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))    TTTTrrrroooollllllll TTTTeeeecccchhhh AAAASSSS ((((9999 JJJJuuuullllyyyy 1111999999998888))))    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       QGLWidget - Widget for rendering OpenGL graphics [Qt OpenGL
  10.       Extension]
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       #include <qgl.h>
  14.  
  15.       Inherits QWidget.
  16.  
  17.     PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrrssss
  18.       QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt (((( QQQQWWWWiiiiddddggggeeeetttt ****    _p_a_r_e_n_t====0000,,,, ccccoooonnnnsssstttt    cccchhhhaaaarrrr **** _n_a_m_e====0000,,,, ccccoooonnnnsssstttt
  19.           QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt    **** _s_h_a_r_e_W_i_d_g_e_t
  20.       QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt (((( ccccoooonnnnsssstttt QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt &&&&    _f_o_r_m_a_t,,,,    QQQQWWWWiiiiddddggggeeeetttt    **** _p_a_r_e_n_t====0000,,,,
  21.           ccccoooonnnnsssstttt cccchhhhaaaarrrr **** _n_a_m_e
  22.       ~~~~QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt ()
  23.       bbbboooooooollll iiiissssVVVVaaaalllliiiidddd (((()))) ccccoooonnnnsssstttt
  24.       vvvvooooiiiidddd mmmmaaaakkkkeeeeCCCCuuuurrrrrrrreeeennnntttt (((())))
  25.       bbbboooooooollll ddddoooouuuubbbblllleeeeBBBBuuuuffffffffeeeerrrr (((()))) ccccoooonnnnsssstttt
  26.       vvvvooooiiiidddd sssswwwwaaaappppBBBBuuuuffffffffeeeerrrrssss (((())))
  27.       ccccoooonnnnsssstttt    QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt&&&& ffffoooorrrrmmmmaaaatttt (((()))) ccccoooonnnnsssstttt
  28.       vvvvooooiiiidddd sssseeeettttFFFFoooorrrrmmmmaaaatttt (((( ccccoooonnnnsssstttt QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt &&&& ffffoooorrrrmmmmaaaatttt ))))
  29.       ccccoooonnnnsssstttt    QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt**** ccccoooonnnntttteeeexxxxtttt (((()))) ccccoooonnnnsssstttt
  30.       vvvvooooiiiidddd sssseeeettttCCCCoooonnnntttteeeexxxxtttt (((( QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt **** _c_o_n_t_e_x_t,,,, ccccoooonnnnsssstttt    QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt ****
  31.           _s_h_a_r_e_C_o_n_t_e_x_t ==== 0000 ))))
  32.  
  33.     PPPPuuuubbbblllliiiicccc SSSSlllloooottttssss
  34.       vvvvooooiiiidddd uuuuppppddddaaaatttteeeeGGGGLLLL    (((())))
  35.  
  36.     PPPPrrrrooootttteeeecccctttteeeedddd MMMMeeeemmmmbbbbeeeerrrrssss
  37.       vvvviiiirrrrttttuuuuaaaallll vvvvooooiiiidddd iiiinnnniiiittttiiiiaaaalllliiiizzzzeeeeGGGGLLLL (((())))
  38.       vvvviiiirrrrttttuuuuaaaallll vvvvooooiiiidddd ppppaaaaiiiinnnnttttGGGGLLLL (((())))
  39.       vvvviiiirrrrttttuuuuaaaallll vvvvooooiiiidddd rrrreeeessssiiiizzzzeeeeGGGGLLLL    (((( iiiinnnntttt _w,,,, iiiinnnntttt hhhh ))))
  40.       vvvviiiirrrrttttuuuuaaaallll vvvvooooiiiidddd ppppaaaaiiiinnnnttttEEEEvvvveeeennnntttt (((( QQQQPPPPaaaaiiiinnnnttttEEEEvvvveeeennnntttt    **** ))))
  41.       vvvviiiirrrrttttuuuuaaaallll vvvvooooiiiidddd rrrreeeessssiiiizzzzeeeeEEEEvvvveeeennnntttt (((( QQQQRRRReeeessssiiiizzzzeeeeEEEEvvvveeeennnntttt **** ))))
  42.  
  43.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  44.       This class is    defined    in the QQQQtttt OOOOppppeeeennnnGGGGLLLL EEEExxxxtttteeeennnnssssiiiioooonnnn, which can
  45.       be found in the qt/extensions    directory. It is not included
  46.       in the main Qt API.
  47.  
  48.       The QGLWidget    class is a widget for rendering    OpenGL
  49.       graphics.
  50.  
  51.       It is    easy to    render OpenGL graphics in Qt applications. You
  52.       can create a subclass    of QGLWidget and reimplement two
  53.       functions: resizeGL()    and paintGL(). The resizeGL() method
  54.       is called whenever the widget    has been resized (and also
  55.       when it shown    for the    first time, since all newly created
  56.       widgets get a    resize event automatically). paintGL() is
  57.       called when the widget needs to be updated.
  58.  
  59.           class MyGLDrawer : public    QGLWidget
  60.  
  61.  
  62.  
  63.      Page 1                         (printed 9/22/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))    TTTTrrrroooollllllll TTTTeeeecccchhhh AAAASSSS ((((9999 JJJJuuuullllyyyy 1111999999998888))))    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))
  71.  
  72.  
  73.  
  74.           {
  75.           Q_OBJECT      // include this if you use Qt    signals/slots
  76.           public:
  77.           MyGLDrawer( QWidget *parent, const char *name    )
  78.               :    QGLWidget(parent,name) {}
  79.           protected:
  80.           void paintGL()
  81.           {
  82.             // draw the    scene
  83.           }
  84.           void resizeGL( int w,    int h )
  85.           {
  86.             // setup viewport, projection etc.
  87.           }
  88.           };
  89.  
  90.       If you need to repaint from other places than    paintGL() (a
  91.       typical example is when using    timers to animate scenes), you
  92.       can call the updateGL() function.
  93.  
  94.       When paintGL() or resizeGL() is called, your widget has been
  95.       made current.    If you need to call the    standard OpenGL    API
  96.       functions from other places (e.g. in your widget's
  97.       constructor),    you must call makeCurrent() first.
  98.  
  99.       Like QGLContext, QGLWidget has advanced functions for
  100.       requesting a new display format, and you can even set    a new
  101.       rendering context.
  102.  
  103.      MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDOOOOCCCCUUUUMMMMEEEENNNNTTTTAAAATTTTIIIIOOOONNNN
  104.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt (((( QQQQWWWWiiiiddddggggeeeetttt **** ppppaaaarrrreeeennnntttt====0000,,,,    ccccoooonnnnsssstttt cccchhhhaaaarrrr **** nnnnaaaammmmeeee====0000,,,,
  105.       ccccoooonnnnsssstttt    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt **** sssshhhhaaaarrrreeeeWWWWiiiiddddggggeeeetttt    ==== 0000,,,, WWWWFFFFllllaaaaggggssss ffff====0000    ))))
  106.       Constructs an    OpenGL widget with a _p_a_r_e_n_t widget and a _n_a_m_e.
  107.  
  108.       The default format is    used.
  109.  
  110.       The _p_a_r_e_n_t, _n_a_m_e and _f arguments are passed to the QWidget
  111.       constructor.
  112.  
  113.       If the _s_h_a_r_e_W_i_d_g_e_t parameter points to a valid QGLWidget,
  114.       this widget will share OpenGL    display    lists with
  115.       _s_h_a_r_e_W_i_d_g_e_t.
  116.  
  117.       Note:    Initialization of OpenGL rendering state etc. should
  118.       be done by overriding    the initializeGL() function, not in
  119.       the constructor of your QGLWidget subclass.
  120.  
  121.       See also: QGLFormat::defaultFormat().
  122.  
  123.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt (((( ccccoooonnnnsssstttt QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt &&&& ffffoooorrrrmmmmaaaatttt,,,, QQQQWWWWiiiiddddggggeeeetttt ****
  124.       ppppaaaarrrreeeennnntttt====0000,,,, ccccoooonnnnsssstttt cccchhhhaaaarrrr **** nnnnaaaammmmeeee====0000,,,, ccccoooonnnnsssstttt QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt **** sssshhhhaaaarrrreeeeWWWWiiiiddddggggeeeetttt
  125.       ==== 0000,,,, WWWWFFFFllllaaaaggggssss ffff====0000 ))))
  126.  
  127.  
  128.  
  129.      PPPPaaaaggggeeee 2222                         ((((pppprrrriiiinnnntttteeeedddd 9999////22222222////99998888))))
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))    TTTTrrrroooollllllll TTTTeeeecccchhhh AAAASSSS ((((9999 JJJJuuuullllyyyy 1111999999998888))))    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))
  137.  
  138.  
  139.  
  140.       Constructs an    OpenGL widget with a _p_a_r_e_n_t widget and a _n_a_m_e.
  141.  
  142.       The _f_o_r_m_a_t argument specifies    the rendering capabilities.
  143.       The widget becomes invalid if    the driver/hardware cannot
  144.       satisfy the requested    format.
  145.  
  146.       The _p_a_r_e_n_t, _n_a_m_e and _f arguments are passed to the QWidget
  147.       constructor.
  148.  
  149.       If the _s_h_a_r_e_W_i_d_g_e_t parameter points to a valid QGLWidget,
  150.       this widget will share OpenGL    display    lists with
  151.       _s_h_a_r_e_W_i_d_g_e_t.
  152.  
  153.       Note:    Initialization of OpenGL rendering state etc. should
  154.       be done by overriding    the initializeGL() function, not in
  155.       the constructor of your QGLWidget subclass.
  156.  
  157.       See also: QGLFormat::defaultFormat() and isValid().
  158.  
  159.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::~~~~QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt (((())))
  160.       Destroys the widget.
  161.  
  162.      ccccoooonnnnsssstttt QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt ****    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::ccccoooonnnntttteeeexxxxtttt (((()))) ccccoooonnnnsssstttt
  163.       Returns the current context.
  164.  
  165.       See also: setContext().
  166.  
  167.      bbbboooooooollll QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::ddddoooouuuubbbblllleeeeBBBBuuuuffffffffeeeerrrr (((()))) ccccoooonnnnsssstttt
  168.       Returns TRUE if double buffering is set in the format    for
  169.       this widget.
  170.  
  171.       See also: QGLFormat::doubleBuffer().
  172.  
  173.      ccccoooonnnnsssstttt QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt &&&& QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::ffffoooorrrrmmmmaaaatttt (((()))) ccccoooonnnnsssstttt
  174.       Returns the widget's format.
  175.  
  176.       See also: setFormat().
  177.  
  178.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::iiiinnnniiiittttiiiiaaaalllliiiizzzzeeeeGGGGLLLL (((()))) [[[[vvvviiiirrrrttttuuuuaaaallll pppprrrrooootttteeeecccctttteeeedddd]]]]
  179.       This virtual function    is called one time before the first
  180.       call to paintGL() or resizeGL(), and then one    time whenever
  181.       the widget has been assigned a new OpenGL context.
  182.       Reimplement it in a subclass.
  183.  
  184.       This function    should take care of setting OpenGL rendering
  185.       flags, defining display lists, etc.
  186.  
  187.       There    is no need to call makeCurrent() because this has
  188.       already been done when this function is called.
  189.  
  190.      bbbboooooooollll QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::iiiissssVVVVaaaalllliiiidddd (((())))    ccccoooonnnnsssstttt
  191.       Returns TRUE if the widget was able to satisfy the specified
  192.  
  193.  
  194.  
  195.      Page 3                         (printed 9/22/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))    TTTTrrrroooollllllll TTTTeeeecccchhhh AAAASSSS ((((9999 JJJJuuuullllyyyy 1111999999998888))))    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))
  203.  
  204.  
  205.  
  206.       constraints.
  207.  
  208.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::mmmmaaaakkkkeeeeCCCCuuuurrrrrrrreeeennnntttt (((())))
  209.       Makes    this widget the    current    widget for OpenGL operations.
  210.       I.e. makes this widget's rendering context the current
  211.       OpenGL rendering context.
  212.  
  213.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::ppppaaaaiiiinnnnttttEEEEvvvveeeennnntttt    (((( QQQQPPPPaaaaiiiinnnnttttEEEEvvvveeeennnntttt ****    )))) [[[[vvvviiiirrrrttttuuuuaaaallll pppprrrrooootttteeeecccctttteeeedddd]]]]
  214.       Handles paint    events.    Calls the virtual function paintGL().
  215.  
  216.       Reimplemented    from QWidget.
  217.  
  218.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::ppppaaaaiiiinnnnttttGGGGLLLL (((())))    [[[[vvvviiiirrrrttttuuuuaaaallll pppprrrrooootttteeeecccctttteeeedddd]]]]
  219.       This virtual function    is called whenever the widget needs to
  220.       be painted. Reimplement it in    a subclass.
  221.  
  222.       There    is no need to call makeCurrent() because this has
  223.       already been done when this function is called.
  224.  
  225.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::rrrreeeessssiiiizzzzeeeeEEEEvvvveeeennnntttt (((( QQQQRRRReeeessssiiiizzzzeeeeEEEEvvvveeeennnntttt    **** )))) [[[[vvvviiiirrrrttttuuuuaaaallll
  226.       pppprrrrooootttteeeecccctttteeeedddd]]]]
  227.       Handles resize events. Calls the virtual function
  228.       resizeGL().
  229.  
  230.       Reimplemented    from QWidget.
  231.  
  232.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::rrrreeeessssiiiizzzzeeeeGGGGLLLL ((((    iiiinnnntttt wwwwiiiiddddtttthhhh,,,, iiiinnnntttt hhhheeeeiiiigggghhhhtttt ))))    [[[[vvvviiiirrrrttttuuuuaaaallll
  233.       pppprrrrooootttteeeecccctttteeeedddd]]]]
  234.       This virtual function    is called whenever the widget has been
  235.       resized. Reimplement it in a subclass.
  236.  
  237.       There    is no need to call makeCurrent() because this has
  238.       already been done when this function is called.
  239.  
  240.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::sssseeeettttCCCCoooonnnntttteeeexxxxtttt    (((( QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt **** ccccoooonnnntttteeeexxxxtttt,,,,    ccccoooonnnnsssstttt
  241.       QQQQGGGGLLLLCCCCoooonnnntttteeeexxxxtttt **** sssshhhhaaaarrrreeeeCCCCoooonnnntttteeeexxxxtttt ==== 0000    ))))
  242.       Sets a new context for this widget. The context must be
  243.       created using    _n_e_w. QGLWidget will delete the context when
  244.       another context is set or when the widget is destroyed.
  245.  
  246.       Calling setContext() will not    alter any display list sharing
  247.       this widget currently    has, unless you    explicitly request
  248.       sharing with a different context by giving a _s_h_a_r_e_C_o_n_t_e_x_t
  249.       parameter that points    to a valid context.
  250.  
  251.       See also: context() and setFormat().
  252.  
  253.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::sssseeeettttFFFFoooorrrrmmmmaaaatttt (((( ccccoooonnnnsssstttt QQQQGGGGLLLLFFFFoooorrrrmmmmaaaatttt &&&& ffffoooorrrrmmmmaaaatttt ))))
  254.       Sets a new format for    this widget. The widget    becomes
  255.       invalid if the requested format cannot be satisfied.
  256.  
  257.       Calling setFormat() will not alter any display list sharing
  258.  
  259.  
  260.  
  261.      Page 4                         (printed 9/22/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))    TTTTrrrroooollllllll TTTTeeeecccchhhh AAAASSSS ((((9999 JJJJuuuullllyyyy 1111999999998888))))    QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt((((3333qqqqtttt))))
  269.  
  270.  
  271.  
  272.       this widget currently    has.
  273.  
  274.       See also: format(), setContext() and isValid().
  275.  
  276.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::sssswwwwaaaappppBBBBuuuuffffffffeeeerrrrssss (((())))
  277.       Swaps    the screen contents with an off-screen buffer. Works
  278.       only if the widget's format specifies    double buffer mode.
  279.  
  280.       See also: doubleBuffer() and QGLFormat::setDoubleBuffer().
  281.  
  282.      vvvvooooiiiidddd QQQQGGGGLLLLWWWWiiiiddddggggeeeetttt::::::::uuuuppppddddaaaatttteeeeGGGGLLLL (((()))) [[[[ssssllllooootttt]]]]
  283.       Updates the widget by    calling    paintGL().
  284.  
  285.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  286.       hhhhttttttttpppp::::////////wwwwwwwwwwww....ttttrrrroooollllllll....nnnnoooo////qqqqtttt////qqqqggggllllwwwwiiiiddddggggeeeetttt....hhhhttttmmmmllll
  287.  
  288.      CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
  289.       Copyright 1992-1997 Troll Tech AS.  See the LICENSE file
  290.       included in the distribution for a complete license
  291.       statement.
  292.  
  293.      AAAAUUUUTTTTHHHHOOOORRRR
  294.       Generated automatically from the source code.
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                         (printed 9/22/98)
  328.  
  329.  
  330.  
  331.